//package com.fortune.conf;
//import io.github.bonigarcia.wdm.WebDriverManager;
//import org.openqa.selenium.By;
//import org.openqa.selenium.JavascriptExecutor;
//import org.openqa.selenium.WebDriver;
//import org.openqa.selenium.WebElement;
//import org.openqa.selenium.chrome.ChromeOptions;
//
//import java.util.List;
//
//public class TOUTIAOPageNewsSpiderbak_noseesetsee {
//    public static void main(String[] args) {
//        // 设置 ChromeDriver 路径
//        System.setProperty("webdriver.chrome.driver", "E:/chromedriver-win64-135.95/chromedriver-win64/chromedriver.exe");
//
//        // 配置 ChromeOptions
//        ChromeOptions options = new ChromeOptions();
//        options.addArguments(
//                "--headless=new",               // 无头模式
//                "--disable-gpu",                // 禁用GPU加速
//                "--no-sandbox",                 // 禁用沙箱
//                "--disable-dev-shm-usage",      // 禁用共享内存
//                "--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
//        );
//
//        // 初始化 WebDriver
////        WebDriver driver = new ChromeDriver(options);
////        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
//
//        WebDriverManager.chromedriver().setup();
//        WebDriver driver = new ChromeDriverUtil().getWebDriver();
//        try {
//
//            String articleUrl = "https://www.toutiao.com/w/1830262211215625/?log_from=b07aff72f50fb8_1745561594049";
////            String articleUrl = "https://www.toutiao.com/w/1829735681920012/?log_from=c5133ee13e7178_1745493027319";
//            driver.get(articleUrl);
//            // 等待文章标题元素可见
////            wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".article-title")));
//
//            // 等待关键元素加载
////            wait.until(d -> d.findElement(By.cssSelector(".article-title")));
//
//            // 获取文章信息
////            String title = driver.findElement(By.cssSelector(".article-title")).getText();
////            String content = driver.findElement(By.cssSelector(".article-content")).getText();
//
////            System.out.println("标题：" + title);
////            System.out.println("内容：" + content.substring(0, Math.min(content.length(), 100)) + "...");
//
//            List<WebElement> element123 = driver.findElements(By.cssSelector(".wtt-content"));
//            //*[@id="root"]/div[2]/div[2]/div[1]/div/div/div/div/h1
//            System.out.println(element123.size());
//
//            System.out.println("```````"+driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div[2]/div[1]/div/div/div/div/div/div/div/a")).getText());
//
//
////            JavascriptExecutor js = (JavascriptExecutor) driver;//将driver转换为js
////            js.executeScript("document.getElementsByClassName('xa-login')[0].style.display='block'");
////            System.out.println("111111"+driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div[2]/div[1]/div/div/div/div/h1")).getText());
////            System.out.println("@@@@@"+driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div[2]/div[1]/div/div/div/div/h1")).isDisplayed());
//
//            JavascriptExecutor js = (JavascriptExecutor) driver;//将driver转换为js
//            js.executeScript("document.getElementsByTagName('h1')[0].style.display='block'");
//            System.out.println("111111"+driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div[2]/div[1]/div/div/div/div/h1")).getText());
//
//
//
//            Thread.sleep(1500);//有用，别删，否则element123获取不到数据
//            element123.forEach(webElement -> {
//                WebElement element = webElement.findElement(By.tagName("h1"));
//                System.out.println("element>>>>"+element.getText());
//
//            });
//
//
////            WebElement element = driver.findElement(By.xpath("//*[@id=\"root\"]/div[2]/div[2]/div[1]/div/div/div/div/h1"));
////            System.out.println("wenzhangtitle--------------->"+element.getText());
//
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
////            driver.quit();
//        }
//    }
//
//
//
//}
